home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Resources / PaperCut Quota 6.1 / pc-setup.exe / {app} / WebAdmin / UserList.asp < prev   
Text File  |  2005-08-17  |  11KB  |  322 lines

  1. <%@ Language=VBScript %>
  2.  
  3. <!-- #INCLUDE FILE="includes/PCCommon.inc" -->
  4. <%
  5.  
  6.     Sub RedirectToUserSearch
  7.         Response.Clear
  8.         Response.Redirect "UserList.asp"
  9.     End Sub
  10.  
  11.  
  12.     Dim objPCWeb
  13.     Set objPCWeb = CreateObject("PCWebAdmin.PCWebUsers")
  14.     If objPCWeb.Error Then
  15.         WriteErrorMessage objPCWeb.ErrorDescription
  16.     End If
  17.  
  18.     if Trim(Request("strUserName")) <> "" then
  19.         '''''''''''''''''''''''''''''''''''''''
  20.         ''''' Start of User Detail Screen '''''
  21.         '''''''''''''''''''''''''''''''''''''''
  22.  
  23.     Dim strUserName
  24.     Dim strComment
  25.  
  26.     strComment = Trim(Request("txtComment"))
  27.     strUserName = Trim(Request("strUserName"))
  28.     if (strUserName = "") then
  29.         ' No username, send them back to the search page
  30.         RedirectToUserSearch
  31.     end if
  32.  
  33.     ' Check for refund call... if so then process
  34.     If Request("cmd") = "refund" Then
  35.         Dim curAmount
  36.         Dim lngJobEntryID
  37.         curAmount = CCur(Trim(Request("curAmount")))
  38.         lngJobEntryID = CLng(Trim(Request("lngJobEntryID")))
  39.         If objPCWeb.RefundUser(strUserName, curAmount, lngJobEntryID, GetText("RefundComment")) Then
  40.             RedirectWithMessage "UserList.asp?strUserName=" & strUserName, GetText("RefundSuccess")
  41.         Else
  42.             gstrErrorMessage = GetText("RefundFailure") & " " & objPCWeb.ErrorDescription
  43.         End If
  44.     End If
  45.  
  46.  
  47. %>
  48. <!--#include file="includes/header.inc" -->
  49. <%
  50.  
  51.     ' Find the details of the user
  52.     Dim intRet
  53.     intRet = objPCWeb.SeekUser(strUserName)
  54.     if intRet > 0 then
  55.         ' No match.  Send them back to the search page.
  56.         RedirectToUserSearch
  57.     end if
  58.  
  59.  
  60.     if (Request("blnSubmitted") <> "") then
  61.         ' Save changes.
  62.         if (Request("lstUnrestricted") = "Unrestricted") then
  63.             objPCWeb.Unrestricted = true
  64.         else
  65.             objPCWeb.Unrestricted = false
  66.         end if
  67.         ' Update credit if an "Add" button was pressed.
  68.         if (IsNumeric(Request("txtCredit"))) then
  69.             ' Didn't click an add $ button or adjustment, so set the credit to what the user selected
  70.             'Response.Write "Credit!!!"
  71.             objPCWeb.SetCredit CDbl(Request("txtCredit")), strComment
  72.         end if
  73.         strComment = ""
  74.     elseif (Request("blnAdjustmentSubmitted") <> "") then
  75.         ' Save changes.
  76.         if (Request("cmdAddOne") <> "") then
  77.             objPCWeb.SetCredit objPCWeb.GetCredit + 1.0, strComment
  78.         elseif (Request("cmdAddFive") <> "") then
  79.             objPCWeb.SetCredit objPCWeb.GetCredit + 5.0, strComment
  80.         elseif (Request("cmdAddTen") <> "") then
  81.             objPCWeb.SetCredit objPCWeb.GetCredit + 10.0, strComment
  82.         elseif (IsNumeric(Request("txtAdjustment"))) then
  83.             if CDbl(Request("txtAdjustment")) <> 0 then
  84.                 objPCWeb.SetCredit objPCWeb.GetCredit + CDbl(Request("txtAdjustment")), strComment
  85.             end if
  86.         end if
  87.         strComment = ""
  88.     end if
  89.  
  90. %>
  91. <h1><%=GetText("UserDetails")%></h1>
  92.  
  93. <P>
  94. <% WriteUserAdminLinks(strUserName) %>
  95.  
  96. <FORM ACTION="UserList.asp" METHOD="POST" id=form1 name=form1>
  97. <INPUT type="hidden" name=strUserName value="<%= strUserName%>">
  98. <INPUT type="hidden" name=blnSubmitted value="T">
  99.  
  100. <TABLE class="webAdmin" width="500">
  101. <TR class="evenRow">
  102.     <TH><%=GetText("Username")%>:</TH>
  103.     <TD><%= objPCWeb.UserName %></TD>
  104. </TR>
  105. <TR class="oddRow">
  106.     <TH><%=GetText("Credit")%>:</TH>
  107.     <TD>
  108.         <INPUT type="text" size=10 name=txtCredit value="<%= objPCWeb.CreditText %>">
  109.    </TD>
  110. </TR>
  111. <TR class="evenRow">
  112.     <TH><%=GetText("PagesPrinted")%>:</TH>
  113.     <TD><%= FormatNumber(objPCWeb.PagesPrinted, 0, true, false, true) %></TD>
  114. </TR>
  115. <% If gblnHasNetCharging Then %>
  116. <TR class="oddRow">
  117.     <TH><%=GetText("NetDataUsed")%>:</TH>
  118.     <TD><%= objPCWeb.TotalMBText & " " & GetText("MBAbbr") %></TD>
  119. </TR>
  120. <TR class="evenRow">
  121.     <TH><%=GetText("NetTimeUsed")%>:</TH>
  122.     <TD><%= objPCWeb.TotalNetHoursText & " " & GetText("HoursAbbr") %></TD>
  123. </TR>
  124. <% End If %>
  125. <TR class="oddRow">
  126.     <TH><%=GetText("Privilege")%>:</TH>
  127.     <TD align=left>
  128.         <SELECT NAME=lstUnrestricted>
  129.             <% if objPCWeb.Unrestricted then %>
  130.                 <OPTION VALUE="Unrestricted" SELECTED><%=GetText("Unrestricted")%>
  131.                 <OPTION VALUE="Restricted"><%=GetText("Restricted")%>
  132.             <% else %>
  133.                 <OPTION VALUE="Unrestricted"><%=GetText("Unrestricted")%>
  134.                 <OPTION VALUE="Restricted" SELECTED><%=GetText("Restricted")%>
  135.             <% end if %>
  136.         </SELECT>
  137.     </TD>
  138. </TR>
  139. <TR class="evenRow">
  140.     <TH width="35%"><%=GetText("Comment")%>:</TH>
  141.     <TD>
  142.         <INPUT type="text" size="50" name="txtComment" maxlength="255" value="<%=Server.HTMLEncode(strComment)%>">
  143.    </TD>
  144. </TR>
  145.  
  146. <TR>
  147.     <TD align=right colspan=2>
  148.         <a href="OtherCharges.asp?txtChargeUser=<%=Server.URLEncode(objPCWeb.UserName)%>"><%=GetText("OtherCharges")%></a>  
  149.         <INPUT type="submit" value="<%=GetText("Save")%>" name=cmdSave>
  150.     </TD>
  151. </TR>
  152. </TABLE>
  153. </FORM>
  154.  
  155. <FORM ACTION="UserList.asp" METHOD="POST" id=form2 name=form2>
  156. <INPUT type="hidden" name=strUserName value="<%= strUserName%>">
  157. <INPUT type="hidden" name=blnAdjustmentSubmitted value="T">
  158. <TABLE class="webAdmin" width="500">
  159. <TR>
  160.     <TD align=left colspan=2><b><%=GetText("AdjustCredit") %></b>
  161.     </TD>
  162. </TR>
  163.  
  164. <TR class="evenOdd">
  165.     <TH width="35%"><%=GetText("Comment")%>:</TH>
  166.     <TD>
  167.         <INPUT type="text" size="50" name="txtComment" maxlength="255" value="<%=Server.HTMLEncode(strComment)%>">
  168.    </TD>
  169. </TR>
  170.  
  171. <TR class="oddRow">
  172.     <TH><%=GetText("QuickAdd")%>:</TH>
  173.  
  174.     <TD align=center>
  175.         <INPUT type="submit" value="<%=GetText("AddOne")%>" name=cmdAddOne>
  176.         <INPUT type="submit" value="<%=GetText("AddFive")%>" name=cmdAddFive>
  177.         <INPUT type="submit" value="<%=GetText("AddTen")%>" name=cmdAddTen>
  178.     </TD>
  179. </TR>
  180.  
  181. <TR class="evenRow">
  182.     <TH><%=GetText("QuickAdjust")%>:</TH>
  183.     <TD>
  184.         <INPUT type="text" size=10 name=txtAdjustment value="<%=FormatCredit(0.0)%>">
  185.         <INPUT type="submit" value="<%=GetText("ApplyAdjustment")%>" name=cmdApplyAdjustment>
  186.     </TD>
  187. </TR>
  188. </TABLE>
  189. </FORM>
  190.  
  191. <% WriteUserAdminLinks(strUserName) %>
  192. <%
  193.  
  194.         '''''''''''''''''''''''''''''''''''''
  195.         ''''' End of User Detail Screen '''''
  196.         '''''''''''''''''''''''''''''''''''''
  197.     else
  198.  
  199.         '''''''''''''''''''''''''''''''''''''
  200.         ''''' Start of User List Screen '''''
  201.         '''''''''''''''''''''''''''''''''''''
  202.  
  203.  
  204.  
  205. %>
  206.  
  207. <!--#include file="includes/header.inc" -->
  208. <h1><h1><%=GetText("UserList")%></h1></h1>
  209. <FORM ACTION="UserList.asp" METHOD="POST">
  210.   <TABLE>
  211.     <TR>
  212.       <TD><B><%=GetText("JumpToUser")%> : </B></TD>
  213.       <TD>
  214.         <INPUT type="text" name=txtUserName value=>
  215.       </TD>
  216.       <TD align=right>
  217.         <INPUT type="submit" value="<%=GetText("Search")%>" name=cmdSearch>
  218.       </TD>
  219.     <TR>
  220.   </TABLE>
  221. </FORM>
  222.  
  223. <%
  224.     Dim intRow
  225.     Dim intStartRecord
  226.     Dim intRecord
  227.  
  228.     intRow = 1
  229.  
  230.     if Trim(Request("txtUserName")) <> "" then
  231.         intStartRecord = objPCWeb.SeekUser(Trim(Request("txtUserName")))
  232.         if LCase(objPCWeb.UserName) = LCase(Trim(Request("txtUserName"))) then
  233.             Response.Redirect "UserList.asp?strUserName=" & Trim(Request("txtUserName"))
  234.         end if
  235.  
  236.         ' Normalise intStartRecord to a page boundary
  237.         intStartRecord = GetStartRecord(GetCurrentPage(intStartRecord), 99999999)
  238.  
  239.     else
  240.         if Request("intStartRecord") = "" then
  241.             intStartRecord = 1
  242.         else
  243.             intStartRecord = Int(Request("intStartRecord"))
  244.         end if
  245.     end if
  246.  
  247.     ' Move to the first record to display
  248.     If Not objPCWeb.EOF Then
  249.         objPCWeb.MoveLast
  250.     End If
  251.  
  252.     objPCWeb.MoveFirst
  253.     If intStartRecord > 1 Then
  254.         objPCWeb.Move intStartRecord-1
  255.     End If
  256.  
  257.     Response.Write "<TABLE align=center width=""90%""><TR><TD align=right>"
  258.     DisplayPageNavigation "UserList.asp", intStartRecord, objPCWeb.RecordCount
  259.     Response.Write "</TD></TR>"
  260.     Response.Write "<TR><TD>"
  261.  
  262.     Response.Write "<TABLE class=""webAdmin"" width=""100%"">"    & vbCRLF
  263.     Response.Write "<TR>" & vbCRLF
  264.     Response.Write "<TH width=""20%"">" & GetText("Username") & "</TH>" & vbCRLF
  265.     Response.Write "<TH width=""15%"">" & GetText("Credit") & "</TH>" & vbCRLF
  266.     Response.Write "<TH width=""20%"">" & GetText("PagesPrinted") & "</TH>" & vbCRLF
  267.     If gblnHasNetCharging or gblnShowUserNetUsageTotals Then 
  268.         Response.Write "<TH width=""10%"">" & GetText("NetDataUsed") & "</TH>" & vbCRLF
  269.         Response.Write "<TH width=""10%"">" & GetText("NetTimeUsed") & "</TH>" & vbCRLF
  270.     End If
  271.     Response.Write "<TH width=""22%"">" & GetText("Privilege") & "</TH>" & vbCRLF
  272.     Response.Write "</TR>" & vbCRLF
  273.  
  274.     do while (not objPCWeb.EOF and intRow <= mintRECORDS_PER_PAGE)
  275.         Response.Write "<TR class=""" & RowClassHelper(intRow) & """>"    & vbCRLF
  276.         Response.Write "<TD width=""20%""><A title=""" & GetText("ModifyUserCredit") & """ HREF=""UserList.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & objPCWeb.UserName & "</A></TD>"  & vbCRLF
  277.  
  278.         if (objPCWeb.GetCredit() < 0) then
  279.             Response.Write "<TD align=right class=""creditNeg"" width=""15%"">" & objPCWeb.CreditText & "</TD>"  & vbCRLF
  280.         else
  281.             Response.Write "<TD align=right class=""creditPos"" width=""15%"">" & objPCWeb.CreditText & "</TD>"  & vbCRLF
  282.         end if
  283.  
  284.         Response.Write "<TD align=right width=""20%""><A title=""" & GetText("ViewPrintLog") & """ HREF=""Log.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & FormatNumber(objPCWeb.PagesPrinted, 0, true, false, true) & "</A></TD>"  & vbCRLF
  285.  
  286.         If gblnHasNetCharging Then
  287.             Response.Write "<TD align=right width=""18%""><A title=""" & GetText("ViewNetUsage") & """ HREF=""NetLog.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & objPCWeb.TotalMBText & " " & GetText("MBAbbr") & "</A></TD>"  & vbCRLF
  288.             Response.Write "<TD align=right width=""18%""><A title=""" & GetText("ViewNetUsage") & """ HREF=""NetLog.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & objPCWeb.TotalNetHoursText & " " & GetText("HoursAbbr") & "</A></TD>"  & vbCRLF
  289.         ElseIf gblnShowUserNetUsageTotals Then
  290.             Response.Write "<TD align=right width=""18%"">" & objPCWeb.TotalMBText & " " & GetText("MBAbbr") & "</TD>"  & vbCRLF
  291.             Response.Write "<TD align=right width=""18%"">" & objPCWeb.TotalNetHoursText & " " & GetText("HoursAbbr") & "</TD>"  & vbCRLF
  292.         End If
  293.  
  294.         if (objPCWeb.Unrestricted) then
  295.             Response.Write "<TD align=center width=""22%"">" & GetText("Unrestricted") & "</TD>"  & vbCRLF
  296.         else
  297.             Response.Write "<TD align=center width=""22%"">" & GetText("Restricted") & "</TD>"  & vbCRLF
  298.         end if
  299.         Response.Write "</TR>" & vbCRLF
  300.         objPCWeb.MoveNext
  301.         intRow = intRow + 1
  302.     loop
  303.     Response.Write "</TABLE>" & vbCRLF
  304.     Response.Write "</TD></TR>" & vbCRLF
  305.     Response.Write "<TR><TD align=right>" & vbCRLF
  306.     DisplayPageNavigation "UserList.asp", intStartRecord, objPCWeb.RecordCount
  307.     Response.Write "</TD></TR></TABLE>"     & vbCRLF
  308.  
  309.     Set objPCWeb = nothing
  310.  
  311.     end if
  312.     '''''''''''''''''''''''''''''''''''
  313.     ''''' End of User List Screen '''''
  314.     '''''''''''''''''''''''''''''''''''
  315.  
  316.  
  317. '    Response.End
  318.     Set objPCWeb = nothing
  319. %>
  320.  
  321. <!--#include file="includes/footer.inc" -->
  322.